﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Project.Models
{
    /// <summary>
    /// 订单
    /// </summary>
    public class Order:BaseModel
    {
        /// <summary>
        /// 顺序号
        /// </summary>
        [StringLength(20)]
        public string OrderNo { get; set; } = "";

        
        /// <summary>
        /// 发布人（雇主）Id
        /// </summary>
        public Guid UserId { get; set; }
      

        /// <summary>
        /// 订单状态（0：发布，1：草稿，2：已接单，3：已完成（待付款），4：已付款，5：已评价）
        /// </summary>
        public int State { get; set; }

        /// <summary>
        /// 订单类型（0：单订单，1：多订单，2：批量订单）
        /// </summary>
        public int Type { get; set; }

        /// <summary>
        /// 服务类型（0：带设计，1：带加工）
        /// </summary>
        public int ServiceType { get; set; }

              

        /// <summary>
        /// 总金额
        /// </summary>
        public decimal SumPrice { get; set; }
        

        /// <summary>
        /// 委托方式（订单类型）， 0：平台  1：抢单  2：指定
        /// </summary>
        public int TrustMethod { get; set; }

        /// <summary>
        /// 雇员Id，可空
        /// </summary>
        public Guid? EmployeeId { get; set; }

        /// <summary>
        /// 订单雇员
        /// </summary>
        [ForeignKey(nameof(EmployeeId))]
        public virtual WebUser Employee { get; set; }
        /// <summary>
        /// 完成时间
        /// </summary>
        public DateTime? ComplationTime { get; set; }

        

        public virtual List<OrderDetail> Details { get; set; }

    }
}
